package com.pickgliss.ui.vo
{
	import com.pickgliss.events.InteractiveEvent;
	import com.pickgliss.ui.ComponentSetting;
	
	import flash.events.EventDispatcher;
	import flash.geom.Point;

	public class AlertInfo extends EventDispatcher
	{
		public static const CANCEL_LABEL:String = "取消";
		public static const SUBMIT_LABEL:String = "确定";

		/**
		 * 构造函数
		 * @param $title Frame的标题
		 * @param $submitLabel	提交按钮的文本, 默认为"确定"
		 * @param $cancelLabel 取消按钮的文本, 默认为"取消"
		 * @param $showSubmit 是否显示确定按钮, 默认为true
		 * @param $showCancel 是否显示取消按钮, 默认为true
		 * @param $data 需要显示的数据
		 * @param $center 是否放置在屏幕中心, 默认为true
		 * @param $movable 是否可移动, 默认为true
		 * @param $enableEnter 是否可以使用回车键, 默认为true
		 * @param $enableEsc 是否可以使用返回键, 默认为true
		 * @param $bottomGap 按钮到Frame底部的像素, 默认为13
		 *
		 */
		public function AlertInfo($title:String = "", $submitLabel:String = SUBMIT_LABEL, $cancelLabel:String = CANCEL_LABEL, $showSubmit:Boolean = true, $showCancel:Boolean = true, $data:Object = null, $center:Boolean = true, $movable:Boolean = true, $enableEnter:Boolean = true, $enableEsc:Boolean = true, $bottomGap:int = 0, $buttonGape:int = 30, $autoDispose:Boolean = false, $smallTip:String = "",$smallTipCall:Function = null)
		{
			title = $title;
			submitLabel = $submitLabel;
			cancelLabel = $cancelLabel;
			showSubmit = $showSubmit;
			showCancel = $showCancel;
			data = $data;
			frameCenter = $center;
			moveEnable = $movable;
			enterEnable = $enableEnter;
			escEnable = $enableEsc;
			bottomGap = $bottomGap;
			buttonGape = $buttonGape;
			autoDispose = $autoDispose;
			smallTip = $smallTip;
			smallTipCall = $smallTipCall;
		}
		
		
		private var _customPos:Point;
		/**
		 *是否自动调整按钮位置 
		 */		
		private var _autoButtonGape:Boolean = true;

		/**
		 * 自动清除
		 */
		private var _autoDispose:Boolean = false;
		
		/**
		 *小贴士内容 
		 */
		private var _smallTip:String;
		/**
		 *小贴士回调 
		 */
		private var _smallTipCall:Function;
		
		/**
		 *按钮到底部的距离
		 */
		private var _bottomGap:int;
		/**
		 *确定按钮与取消按钮之间的间距
		 */
		private var _buttonGape:int = ComponentSetting.ALERT_BUTTON_GAPE;
		/**
		 *取消按钮的文本
		 */
		private var _cancelLabel:String = CANCEL_LABEL;
		/**
		 *用于显示的数据
		 */
		private var _data:Object;
		/**
		 *是否是htmlText模式赋值
		 */
		private var _enableHtml:Boolean;
		/**
		 *是否支持enter键
		 */
		private var _enterEnable:Boolean = true;
		/**
		 *是否支持esc键
		 */
		private var _escEnable:Boolean = true;
		/**
		 *弹出窗是否居中显示
		 */
		private var _frameCenter:Boolean = true;
		/**
		 *窗体能否移动
		 */
		private var _moveEnable:Boolean = true;
		/**
		 * 弹出窗是否支持多行显示
		 * 如果支持多行显示那么文本框的宽度长度将由
		 * textShowHeight和textShowWidth这两个属性决定
		 */
		private var _mutiline:Boolean;
		/**
		 *是否显示取消按钮
		 */
		private var _showCancel:Boolean = true;
		/**
		 *是否显示确定按钮
		 */
		private var _showSubmit:Boolean = true;
		/**
		 *确定按钮的文本
		 */
		private var _submitLabel:String = SUBMIT_LABEL ;
		/**
		 * 文本框的高度
		 * 当mutiline=true时启用
		 */
		private var _textShowHeight:int;
		/**
		 * 文本框的宽度
		 * 当mutiline=true时启用
		 */
		private var _textShowWidth:int;
		/**
		 *标题文本
		 */
		private var _title:String;
		
		/**
		 *播放声音的方法 
		 */		
		private var _closeSoundFunc:Function;
		private var _submitSoundFunc:Function;
		
		public function get autoButtonGape():Boolean
		{
			return _autoButtonGape;
		}
		public function set autoButtonGape(value:Boolean):void
		{
			if(_autoButtonGape == value)return;
			_autoButtonGape = value;
			fireChange();
		}

		public function get autoDispose():Boolean
		{
			return _autoDispose;
		}

		public function set autoDispose(value:Boolean):void
		{
			if(_autoDispose == value)return;
			_autoDispose = value;
			fireChange();
		}
		
		public function get smallTip():String
		{
			return _smallTip;
		}
		public function set smallTip(value:String):void
		{
			if(_smallTip == value) return;
			_smallTip = value;
			fireChange();
		}
		
		public function get smallTipCall():Function
		{
			return _smallTipCall;
		}
		public function set smallTipCall(value:Function):void
		{
			if(_smallTipCall == value) return;
			_smallTipCall = value;
			fireChange();
		}

		public function get bottomGap():int
		{
			return _bottomGap;
		}

		public function set bottomGap(value:int):void
		{
			if(_bottomGap == value)return;
			_bottomGap = value;
			fireChange();
		}

		public function get buttonGape():int
		{
			return _buttonGape;
		}

		public function set buttonGape(value:int):void
		{
			if(_buttonGape == value)return;
			_buttonGape = value;
			fireChange();
		}

		public function get cancelLabel():String
		{
			return _cancelLabel;
		}

		public function set cancelLabel(value:String):void
		{
			if(_cancelLabel == value)return;
			_cancelLabel = value;
			fireChange();
		}

		public function get data():Object
		{
			return _data;
		}

		public function set data(value:Object):void
		{
			if(_data == value)return;
			_data = value;
			fireChange();
		}

		public function get enableHtml():Boolean
		{
			return _enableHtml;
		}

		public function set enableHtml(value:Boolean):void
		{
			if(_enableHtml == value)return;
			_enableHtml = value;
			fireChange();
		}

		public function get enterEnable():Boolean
		{
			return _enterEnable;
		}

		public function set enterEnable(value:Boolean):void
		{
			if(_enterEnable == value)return;
			_enterEnable = value;
			fireChange();
		}

		public function get escEnable():Boolean
		{
			return _escEnable;
		}

		public function set escEnable(value:Boolean):void
		{
			if(_escEnable == value)return;
			_escEnable = value;
			fireChange();
		}

		public function get frameCenter():Boolean
		{
			return _frameCenter;
		}

		public function set frameCenter(value:Boolean):void
		{
			if(_frameCenter == value)return;
			_frameCenter = value;
			fireChange();
		}

		public function get moveEnable():Boolean
		{
			return _moveEnable;
		}

		public function set moveEnable(value:Boolean):void
		{
			if(_moveEnable == value)return;
			_moveEnable = value;
			fireChange();
		}

		public function get mutiline():Boolean
		{
			return _mutiline;
		}

		public function set mutiline(value:Boolean):void
		{
			if(_mutiline == value)return;
			_mutiline = value;
			fireChange();
		}

		public function get showCancel():Boolean
		{
			return _showCancel;
		}

		public function set showCancel(value:Boolean):void
		{
			if(_showCancel == value)return;
			_showCancel = value;
			fireChange();
		}

		public function get showSubmit():Boolean
		{
			return _showSubmit;
		}

		public function set showSubmit(value:Boolean):void
		{
			if(_showSubmit == value)return;
			_showSubmit = value;
			fireChange();
		}

		public function get submitLabel():String
		{
			return _submitLabel;
		}

		public function set submitLabel(value:String):void
		{
			if(_submitLabel == value)return;
			_submitLabel = value;
			fireChange();
		}

		public function get textShowHeight():int
		{
			return _textShowHeight;
		}

		public function set textShowHeight(value:int):void
		{
			if(_textShowHeight == value)return;
			_textShowHeight = value;
			fireChange();
		}

		public function get textShowWidth():int
		{
			return _textShowWidth;
		}

		public function set textShowWidth(value:int):void
		{
			if(_textShowWidth == value)return;
			_textShowWidth = value;
			fireChange();
		}


		public function get title():String
		{
			return _title;
		}

		public function set title(value:String):void
		{
			if(_title == value)return;
			_title = value;
			fireChange();
		}
		
		/**
		 * 播放声音的方法
		 */	
		public function get closeSoundFunc():Function{
			return _closeSoundFunc;
		}
		
		public function get submitSoundFunc():Function{
			return _submitSoundFunc;
		}
		
		public function set closeSoundFunc(func:Function):void
		{
			if(_closeSoundFunc == func)return;
			_closeSoundFunc = func;
			fireChange();
		}
		
		public function set submitSoundFunc(func:Function):void{
			if(_submitSoundFunc == func)return;
			_submitSoundFunc = func;
			fireChange();
		}
		
		private function fireChange():void
		{
			dispatchEvent(new InteractiveEvent(InteractiveEvent.STATE_CHANGED));
		}

		public function get customPos():Point
		{
			return _customPos;
		}

		public function set customPos(value:Point):void
		{
			_customPos = value;
		}

	}
}